package com.itheima.dao;

import com.itheima.pojo.OrderSetting;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;

@Mapper
public interface UserOrderSettingDao {
    /**
     * 根据日期查询预约表中是否已有数据
     * @param date
     * @return
     */
    @Select("select * from t_ordersetting where orderDate = #{date}")
    OrderSetting getByDate(LocalDate date);

    /**
     * 更新已预约人数
     * @param orderSetting
     */
    @Update("update t_ordersetting set reservations = #{reservations} where orderDate = #{orderDate}")
    void updateReservations(OrderSetting orderSetting);
}
